package com.bianyuanren.v4.controller.slide;

import com.bianyuanren.common.core.controller.BaseController;
import com.bianyuanren.common.core.domain.AjaxResult;
import com.bianyuanren.v4.service.slide.IPpSlideRecordService;
import com.bianyuanren.v4.pojo.slide.PpSlideRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/api/slide/record")
public class PpSlideRecordController extends BaseController {

    @Autowired
    private IPpSlideRecordService ppSlideRecordService;

    @RequestMapping("/add")
    public AjaxResult add(@Validated PpSlideRecord ppSlideRecord) {

        return ppSlideRecordService.insertSlideRecord(ppSlideRecord);
    }


    @RequestMapping("/getNUm")
    /**
     * 判断滑动次数是否到期
     */
    public AjaxResult getNUm(Boolean slide) {
        if (slide == true) {
            return ppSlideRecordService.getNUm();
        }
        return AjaxResult.success("没有滑动");
    }

    /**
     * 判断当前用户是否有划算次数
     * 0有划动次数 1不能滑动
     */
    @RequestMapping("/whetherSlide")
    public AjaxResult whetherSlide() {
        return ppSlideRecordService.whetherSlide();
    }

}
